# Name:    CKeyPressHnd.py
# Date:    Sun Mar 28 21:24:42 CEST 2010
# Purpose: Handles key pressing
# Def:     CKeyPressHnd()
# Inputs:  

import gtk

####################################################################################################

class CKeyPressHnd():
	__event = None

#---------------------------------------------------------------------------------------------------

	def __init__(self, event = None):
		self.__event = event

#---------------------------------------------------------------------------------------------------

	def getEvent(self):
		return self.__event

#---------------------------------------------------------------------------------------------------

	def setEvent(self, event):
		self.__event = event

#---------------------------------------------------------------------------------------------------

	def processEvent(self):
		ev = self.__event

		# Ctrl+Q handling
		if ev.state & gtk.gdk.CONTROL_MASK:
			if gtk.gdk.keyval_name(ev.keyval).upper() == 'Q':
				# TODO: use callback function in the main class instead
				gtk.main_quit()
		
####################################################################################################
